<?php

declare(strict_types=1);

namespace App\Model\Ai\Drawing;



use App\Model\Model;
use App\Model\User;

/**
 * @property int $id 
 * @property int $user_id 
 * @property int $server_id 
 * @property string $prompt 
 * @property string $negative_prompt 
 * @property int $width 
 * @property int $height 
 * @property string $model_hash 
 * @property string $vae_hash 
 * @property string $sd_model_checkpoint 
 * @property string $sd_vae 
 * @property string $sampler_name 
 * @property int $steps 
 * @property int $batch_size 
 * @property string $type 
 * @property string $ip 
 * @property int $weight 
 * @property string $more 
 * @property string $status 
 * @property int $createtime 
 * @property int $updatetime 
 */
class DrawingTask extends Model
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ai_drawing_task';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = [];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'server_id' => 'integer', 'width' => 'integer', 'height' => 'integer', 'steps' => 'integer', 'batch_size' => 'integer', 'weight' => 'integer', 'createtime' => 'integer', 'updatetime' => 'integer'];
	
	
	const CREATED_AT = 'createtime';
	const UPDATED_AT = 'updatetime';
	
	/**
	 * Convert a DateTime to a storable string.
	 *
	 * @return null|string
	 */
	public function fromDateTime(mixed $value): mixed
	{
		return empty($value) ? $value : strval($this->asDateTime($value)->timestamp);
	}
	
	public function user()
	{
		return $this->hasOne(User::class, 'id', 'user_id');
	}
}
